package com.sqx.modules.repairRecord.controller;


import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.repairRecord.entity.RepairRecord;
import com.sqx.modules.repairRecord.service.RepairRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wuchang
 * @since 2022-12-12
 */

@RestController
@Api(value = "补费记录", tags = {"用户端-补费记录"})
@RequestMapping("/app/repairRecord/")
public class AppRepairRecordController {
    @Autowired
    private RepairRecordService repairRecordService;

    @Login
    @ApiOperation("商家退费")
    @GetMapping("refundRepair")
    public Result refundRepair(@RequestAttribute("userId")Long userId,Long recordId){
        return repairRecordService.refundRepair(userId,recordId);
    }

    @Login
    @ApiOperation("获取补费记录列表")
    @GetMapping("getRecordList")
    public Result getRecordList(@RequestAttribute("userId")Long userId, Integer page, Integer limit, RepairRecord repairRecord){
        repairRecord.setUserId(userId);
        return Result.success().put("data", repairRecordService.getRecordList(page,limit,repairRecord));
    }
}

